Skip to content

feat: enforce secret requirement for session creation#1025

Merged
bjohansebas merged 8 commits into
expressjs:v2from
bjohansebas:secret_session
Apr 27, 2025
Merged

feat: enforce secret requirement for session creation#1025
bjohansebas merged 8 commits into
expressjs:v2from
bjohansebas:secret_session

Conversation

@bjohansebas

@bjohansebas bjohansebas commented Feb 13, 2025

Copy link
Copy Markdown
Member

Now it is mandatory to have a secret to create the session, a deprecated feature has been removed.

Context:

That is from the early days of Connect (senchalabs/connect#580). Initially, they used cookie-parser to secure cookies. Now, the package itself has the option to handle it on its own, so it is safe to remove it since this package is being decoupled from cookie-parser

Comment thread index.js Outdated
// backwards compatibility for signed cookies
// req.secret is passed from the cookie parser middleware
var secrets = secret || [req.secret];
var secrets = secret;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to review this part because if I remove it, the tests still pass. It's likely that several tests need to be created if this is necessary.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is from the early days of Connect (senchalabs/connect#580). Initially, they used cookie-parser to secure cookies. Now, the package itself has the option to handle it on its own, so it is safe to remove it since this package is being decoupled from cookie-parser.

@bjohansebas
bjohansebas changed the base branch from master to v2 February 13, 2025 03:20
@bjohansebas
bjohansebas marked this pull request as ready for review February 13, 2025 04:39

@raphendyr raphendyr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find the logic to bee correct. Some minor notions in comments.

Comment thread test/session.js Outdated
Comment thread index.js Outdated
Comment thread test/session.js

@raphendyr raphendyr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. Just needs a decisions about const and lint.

Comment thread test/session.js Outdated

@raphendyr raphendyr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's perfect now!

@bjohansebas
bjohansebas merged commit f5b5ebb into expressjs:v2 Apr 27, 2025
@bjohansebas
bjohansebas deleted the secret_session branch April 27, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants